<template>
  <div style="margin: 0; padding: 0;">
    <el-form size="medium" ref="myForm" :model="formData" :label-width="labelForm.labelWidth"
      :label-position="labelForm.labelPosition">
      <el-row>
        <el-col :span="24" v-for="(item,index) in columnFinalData" :key="index">
          <!-- 文本框 -->
          <el-form-item v-if="item.fieldType==1" :prop="item.field" :rules="{
                    required: true, message: '请输入2', trigger: 'change'}">
            <template slot="label">
              {{item.label}}
            </template>
            <el-input v-model="formData[item.name]" placeholder="请输入" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <!-- <div :span="24" v-for="(item,index) in columnFinalData" :key="index">
      <div style="line-height: 50px;height: 50px;text-align: left;">
        {{item.label}}
      </div>
      <div style="text-align: left;height: 80px;">
        <el-input size="medium" :disabled="true" v-model="formData[item.name]" placeholder="" />
      </div>
    </div> -->
  </div>
</template>

<script>
  import defaultSettings from '@/settings'
  export default {
    name: 'print-form',
    props: {
      columnFinalData: {
        type: Array,
        default: () => ([])
      },
      tableData: {
        type: Array,
        default: () => ([])
      },
      printTitle: {
        type: String,
        default: ''
      },
      dataIndex: {
        type: Number,
        default: 0
      }
    },
    watch: {
      dataIndex: {
        handler(newValue, oldValue) {
          this.formData = this.tableData[this.dataIndex]
        }
      }
    },
    data() {
      return {
        labelForm: defaultSettings.labelForm,
        formData: {},
        currIndex: 0
      }
    },
    computed: {},
    created() {
      this.formData = this.tableData[this.dataIndex]
    },
    methods: {

    }
  }
</script>
<style rel="stylesheet/scss" lang="scss">
  .el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label:before,
  .el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap>.el-form-item__label:before {
    content: '*';
    color: #ff4949;
    margin-right: 4px;
  }
  .el-form-item--medium .el-form-item__label{
    display: inherit;
  }
</style>
